/*
 * @Author: your name
 * @Date: 2021-07-14 20:56:15
 * @LastEditTime: 2021-07-14 21:04:40
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vue-hr-project\src\directives\index.js
 */
import store from '@/store'

const directivePlugin = {
  install(Vue) {
    Vue.directive('checkBtn', {
      inserted(el, binding) {
        const points = store.state.user.userInfo.roles.points
        // el:指令写到那个元素上 它拿到的就是那个dom元素
        // binding:value 指令绑定的值是什么velue就是什么
        if (!points.includes(binding.value)) {
          el.parentNode.removeChild(el)
        }
      }
    })
  }
}
export default directivePlugin
